/**************************************************************************************
*
*	Copyright (C) 2009 - 2012 Brent Andrew O. Chua - See LICENSE.txt for more info.
*		
*	Filename	-	RenderEntryProjection.cpp
*
*	Comments	-	See RenderEntryProjection.h
*
**************************************************************************************/

#include "../Include/RenderEntryProjection.h"
#include "../Include/Engine.h"
#include "../Include/GlobalGraphicsStrings.h"
#include "../Include/ParameterBinderMatrixRef.h"

namespace Pulse
{
	RenderEntryProjection::RenderEntryProjection( void )
		: m_pProjection( PSX_NULL )
	{
		SetStage( ERenderViewStage::MAIN );

		ParameterSystem *pParamSys = Engine::GetInstance()->GetRenderer()->GetParameterSystem();

		ParameterMatrix *pParamProj = pParamSys->GetMatrix( GFX_PARAM_PROJECTION );

		m_pProjBinder = new ParameterBinderMatrixRef( pParamProj );
	}

	RenderEntryProjection::~RenderEntryProjection( void )
	{
		delete m_pProjBinder;
	}

	void RenderEntryProjection::Execute( GraphicsPipeline *pPipeline )
	{
		m_pProjBinder->SetData( m_pProjection );
		m_pProjBinder->BindValue();
	}

	void RenderEntryProjection::SetProjectionMatrix( const Matrix4x4 *pProj )
	{
		m_pProjection = pProj;
	}
}